<?php
require_once BASE_PATH.'application/models/basedao'.EXT;
class cursoDAO extends baseDAO {

    var $table = 'curso';
    var $id    = 'num_curso';
	
	
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();

    }
    
    function _defaultSQL(){
	$this->db->select_min('modulo_curso.dia');
	$this->db->select("
			  modulo_curso.hora,
			  curso.*,
			  instructor.num_instructor,
			  instructor.nombre as instructor,
			  instructor.puesto,instructor.bio
			");
	
	
	$this->db->where('( dia!="0000-00-00" AND dia >= NOW() )',NULL,false);

	$this->db->join("modulo_curso", $this->table.".".$this->id." = modulo_curso.num_curso");
	$this->db->join("instructor", $this->table.".".$this->id." = instructor.num_curso");
	
	$this->db->group_by($this->table.".".$this->id); 
    }
    
    
    function getModulosById($id){
	$this->load->model("modulocursoDAO");

	return $this->modulocursoDAO->findByCursoId($id);
	
    }
    

}
?>